﻿using Microsoft.Extensions.Options;
using OSS.Http;
using OSS.PaySdk.Ali.Pay.Mos;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace OSS.PaySdk.Ali.Pay
{
    /// <summary>
    /// 转账接口
    /// https://docs.open.alipay.com/api_28/alipay.fund.trans.toaccount.transfer
    /// </summary>
    public class ZPayTransferApi : ZPayBaseApi
    {
        /// <summary>
        ///  构造函数
        /// </summary>
        /// <param name="config"></param>
        public ZPayTransferApi(IOptions<ZPayConfigWrapper> options, HttpManager httpManager) 
            : base(options.Value?.ZPayConfig, httpManager)
        {
        }

        /// <summary>
        /// 单笔转账到支付宝账户接口
        /// </summary>
        /// <param name="transferReq"></param>
        public async Task<ZPayTransferResp> TransferAsync(ZPayTransferReq transferReq)
        {
            const string respColumnName = "alipay_fund_trans_toaccount_transfer_response";
            const string apiMethod = "alipay.fund.trans.toaccount.transfer";

            return await PostApiAsync<ZPayTransferReq, ZPayTransferResp>(apiMethod, respColumnName, transferReq);
        }
    }
}
